﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using YiSha.Util;
using YiSha.Util.Extension;
using YiSha.Util.Model;
using YiSha.Entity.QixingManage;
using YiSha.Model.Param.QixingManage;
using YiSha.Service.QixingManage;
using YiSha.Model.Result.QixingManage;

namespace YiSha.Business.QixingManage
{
    /// <summary>
    /// 创 建：admin
    /// 日 期：2023-03-25 18:49
    /// 描 述：微信群聊业务类
    /// </summary>
    public class WXCorpGroupChatBLL
    {
        private WXCorpGroupChatService wXCorpGroupChatService = new WXCorpGroupChatService();

        #region 获取数据
        public async Task<TData<List<WXCorpGroupChatEntity>>> GetList(WXCorpGroupChatListParam param)
        {
            TData<List<WXCorpGroupChatEntity>> obj = new TData<List<WXCorpGroupChatEntity>>();
            obj.Data = await wXCorpGroupChatService.GetList(param);
            obj.Total = obj.Data.Count;
            obj.Tag = 1;
            return obj;
        }

        public async Task<TData<List<WXCorpGroupChatDto>>> GetPageList(WXCorpGroupChatListParam param, Pagination pagination)
        {
            TData<List<WXCorpGroupChatDto>> obj = new TData<List<WXCorpGroupChatDto>>();
            obj.Data = await wXCorpGroupChatService.GetPageList(param, pagination);
            obj.Total = pagination.TotalCount;
            obj.Tag = 1;
            return obj;
        }

        public async Task<TData<WXCorpGroupChatEntity>> GetEntity(long id)
        {
            TData<WXCorpGroupChatEntity> obj = new TData<WXCorpGroupChatEntity>();
            obj.Data = await wXCorpGroupChatService.GetEntity(id);
            if (obj.Data != null)
            {
                obj.Tag = 1;
            }
            return obj;
        }
        #endregion

        #region 提交数据
        public async Task<TData<string>> SaveForm(WXCorpGroupChatEntity entity)
        {
            TData<string> obj = new TData<string>();
            await wXCorpGroupChatService.SaveForm(entity);
            obj.Data = entity.Id.ParseToString();
            obj.Tag = 1;
            return obj;
        }

        public async Task<TData> DeleteForm(string ids)
        {
            TData obj = new TData();
            await wXCorpGroupChatService.DeleteForm(ids);
            obj.Tag = 1;
            return obj;
        }
        #endregion

        #region 私有方法
        #endregion
    }
}
